﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chinesys.Entities;

namespace Chinesys.Domain.InputValidations
{
    public class OrderDetailInputValidation : InputValidationBase
    {
        private OrderDetailEntity entity;

        public OrderDetailInputValidation(OrderDetailEntity entity)
        {
            this.entity = entity;
        }

        public override void Validate()
        {
            if (entity.OrderId < 1)
                Errors.Add(new Required("Order Id"));

            if (entity.ProductId < 1)
                Errors.Add(new Required("Product Id"));

            if (entity.UnitPrice < 0)
                Errors.Add(new Required("Unit Price"));

            if (entity.Quantity < 0)
                Errors.Add(new Required("Quantity"));
        }
    }
}
